package com.example.cloudsampleconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/restTemplate")
public class RestTempleController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/sayHello")
    public String sayHello() {
        String forObject = restTemplate.getForObject("http://cloud-sample-provider/sayHello", String.class);
        return "restTemplate: " + forObject;
    }
}
